# Contributor: Timo Teräs <timo.teras@iki.fi>
# Maintainer: Timo Teräs <timo.teras@iki.fi>
pkgname=libmatroska
pkgver=1.7.1
pkgrel=0
pkgdesc="Extensible multimedia container format based on EBML"
url="https://www.matroska.org/"
arch="all"
options="!check"  # Tests don't build; 'make check' target disabled by upstream
license="LGPL-2.1-or-later"
makedepends="cmake libebml-dev>=1.4.2 samurai"
subpackages="$pkgname-dev"
source="https://dl.matroska.org/downloads/libmatroska/libmatroska-$pkgver.tar.xz"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	CXXFLAGS="$CXXFLAGS -flto=auto" \
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		$CMAKE_CROSSOPTS
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
a6f38d388f6c9bfe399b9263ba4ef0965cfb4e27b39ac04453d5c9a9db8eac719a04c87b58d88b612902297e17aa7437382a66332f3f5b3d41744a13351751fd  libmatroska-1.7.1.tar.xz
"
